﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Areas/Admin/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<Ovvio.Web.Areas.Admin.Models.UserModel>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Users
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <% Html.Telerik().Grid(Model)
        .Name("UserGrid")
        .DetailView(userDetailView => userDetailView.Template( o =>
            {
                %>
                    <div style="width:300px">
                        <div class="display-label">Last Login Date</div>
                        <div class="display-field"><%= Html.Encode(o.LastLoginDate) %></div>
                        <div class="display-label">Updated By</div>
                        <div class="display-field"><%= Html.Encode(o.UpdatedBy) %></div>
                    </div>
                <%
            }))
        .DataKeys(keys => { keys.Add(p => p.Id).RouteKey("Id"); })
        .ToolBar(commands => { commands.Insert().ButtonType(GridButtonType.BareImage); })
        .DataBinding( dataBinding => dataBinding.Server()
            .Insert("Create", "Users", new { mode = GridEditMode.PopUp, type = GridButtonType.BareImage})
            .Update("Update","Users", new { mode = GridEditMode.PopUp, type = GridButtonType.BareImage})
            .Delete("Delete","Users", new { mode = GridEditMode.PopUp, type = GridButtonType.BareImage})
            )
        .Sortable()
        .Columns(columns =>
        {
            columns.Bound(o => o.Username);
            columns.Bound(o => o.FirstName);
            columns.Bound(o => o.LastName);
            columns.Bound(o => o.Mobile);
            columns.Bound(o => o.Email);
            columns.Bound(o => o.Role);
            columns.Bound(o => o.IsNewsLetterSubscriber);
            columns.Command(commands =>
                {
                    commands.Edit().ButtonType(GridButtonType.BareImage);
                    commands.Delete().ButtonType(GridButtonType.BareImage);
                });
       })
       .Editable(editing => editing.Mode(GridEditMode.PopUp))
       .Scrollable(scroll => scroll.Height(300))
       .Render();
    %>

</asp:Content>

